#include <bits/stdc++.h>
using namespace std;
int n, a;
string b, c, d, e;
int main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a >> b >> c >> d >> e;
        if (b.size() == 2 && e.size() == 2){
            cout << a << " " << b << " = " << a*1000000 << " " << e << endl;
        }
        else cout << a << " " << b << " = " << a*100 << " " << e << endl;
    }
    return 0;
}